package org.zjsru.springclouddemo5418.Poke;

public class CardComparator {
    public static int compare(Card card1, Card card2) {
        if (card1.getValue() != card2.getValue()) {
            return card1.getValue() - card2.getValue();
        } else {
            String[] suits = {"♠", "♥", "♣", "♦"};
            return suits.length - java.util.Arrays.asList(suits).indexOf(card1.getSuit())
                    - (suits.length - java.util.Arrays.asList(suits).indexOf(card2.getSuit()));
        }
    }
}